Associate 1.7 for Windows 95 and NT

Introduction

Associate 1.7 is FreeWare. Associate is a shortcut for clicking 
View - Options - File types in Windows Explorer, or taking the 
same walk using registry editors like RegEdit. This is where 
Associate is about. Being in control when double or right 
clicking an icon in Explorer or any Windows 95 or NT file 
dialog. Quickly editing the default open command that gets 
executed when you double click an icon, editing the items of 
the alternate mouse button menus, setting of icons, 
descriptions, and more.

What you need to know

Associate is a program for "advanced" users. For using 
Associate effectively, you will need to have, or develop, a 
basic understanding of how Windows assigns properties to file 
extensions. Use Associate very carefully until you really 
understand what you are doing.
Associate will guide you as much as possible, and by 
visualizing the settings Windows stores, should give you a clue 
of the nice possibilities made accessible by being able to edit 
these setting very quickly.
If you are not that "advanced", but interested, you can find a 
few basics in the remainder of this document.

Note for NT users

NT users must have the rights to edit the registry to get 
access to all possibilities of Associate. I did NOT have the 
time to test Associate on accounts with limited rights. On 
accounts with full rights Associate works well. You can find 
out whether you have enough rights by starting RegEdit and than 
try to access the keys found beneath HKEY_CLASSES_ROOT. If you 
are not allowed to access them don't bother to install 
Associate or ask your system administrator for more rights.

Download and installation

To install Associate simply download Associate_1.7.zip (192K) 
and extract Associate.exe to your hard disk to a folder of your 
choice. Included in the zip you find "Read me Associate 
1.7.txt" discussing the same topics as the documents on this 
site.
To make Associate accessible from the 'Copy to' menu of 
Explorer, you can place a shortcut to Associate.exe in your 
SendTo folder. A description of the SendTo folder can be found 
in Windows Help accessible from the Start - Help - Index topic 
SendTo. 

Windows and file name extensions

Hint 

Don't bother if some of the next is nonsense to you. If it's 
ALL nonsense to you then make sure you backup your Windows 
registry often.

Extensions and file types

Based on the extension of a file name the windows shell 
(Explorer, command.com (Windows 95), cmd.exe (NT), common file 
dialogs, etc.) determines what action to take when you 
manipulate a file. Windows associates file extensions with file 
types. Often more than one extension will be associated with 
one file type. The file extensions and file types are stored in 
the Windows registry and describe the properties of files with 
the specified extensions. For instance .txt is often associated 
with the file type txtfile describing the way files with 
extension .txt will behave in Explorer. One of the things a 
file type like txtfile can specify is the shell command to 
execute when double clicking on an associated icon. A file type 
can have more than one shell command associated with it. 
Windows will summarize the available commands for a file type 
when the user right-clicks a file and present them in the 
alternate popup menu ready to launch.

Other ways of editing associations

Normally you would use the dialogs found in Explorers menu View 
- Options - File Types, to edit these associations. Normally 
also, when you double click a file of which the extension is 
still unknown to Windows, you get a dialog box asking you which 
program to start. If you check the 'Always use this program' 
check box, and click OK, you establish an association between 
the file extension and the program just selected. If you ever 
use RegEdit you can find your private associations beneath the 
registry key HKEY_CLASSES_ROOT.

Documentation

Names of file types you might encounter in your registry like 
txtfile, bmpfile, Folder, Unknown, * might already give you a 
good impression of what they stand for. Documentation of the 
settings made accessible by Associate can be found on your 
Windows CD-ROM. For Windows 95 users in the Windows 95 Resource 
Kit, for NT users in the NT On-line books. Additional 
information for programmers can be found in the Win32 SDK.

Using Associate

Introduction

It can be handy to have control over the actions triggered by 
double or right clicking an Icon, and that is where Associate 
jumps in. Associate is intended to edit the extensions and file 
types found in the Windows registry. Basically Associate is an 
image of what is stored in the registry for a particularly 
extension and its associated file type.

Starting Associate

If you did make a shortcut in your SendTo folder and start 
Associate with the 'Copy to' item of the alternate mouse button 
menu in Explorer, it will come up with the extension of the 
file selected in Explorer focused. Associate will have looked 
up the settings for the extension and its associated file type. 
Whenever Associate is started with a file name passed as 
parameter on its command line it will start with the extension 
of the passed file name selected. If you start Associate 
without passing a file name, Associate will start with the 
settings for the file type 'Unknown', which Windows uses to 
handle file extension it does not know about.

Creating an association between an extension and a file type

After you specified the extension to edit in the combo box 
labeled 'Extension' you can select an existing file type for 
the extension from the combo box labeled 'File type', or create 
a new file type by entering a new name into this combo. An 
often used convention is to name the file type after its 
associated extension. The extension .txt would result in the 
file type txtfile, .bmp into bmpfile etc.. This convention is 
used by Associate when you activate the file type combo and 
there is not yet a file type associated with the selected 
extension. Associate will propose the extension post fixed with 
'file' as name for the file type to use.

Commands to execute

Once you established the association between the extension and 
the file type you can start editing the verbs and commands 
windows knows about for this file type. They will appear in the 
alternate menu when right clicking in Explorer and they are 
accessible through the combo box labeled 'Shell verbs'. If you 
want to add a new verb, just type a name into the box labeled 
'verb' and click on the browse button, on the right of the edit 
control labeled 'Command'. You can choose the program you want 
to start when selecting this menu item. Explorer uses the name 
of the verb, or if specified, the text in the edit control 
labeled 'Description of shell verb' to build it's alternate 
menu's. Standard verbs used are open, edit, printto, or openas.

Commands and long file names

A note on the command line syntax and long file names. When you 
press the browse button and select a program Associate will 
compose the command for you by placing the full program file 
name in double quotes and appending "%1" at the end. The double 
quotes will guarantee that long file names with spaces will be 
properly passed to the specified program. For all well written 
32 bit Windows programs handling long file names as they should 
this will work fine. When your program is a program which does 
not handle long file names on the command line properly you can 
remove the double quotes from the %1. Windows will pass the 
short DOS 8.3 file name to the program instaed of the long one. 
Mostly when a program is not able of handling a passed long 
file name removing the double quotes from %1 will do the trick.

Default open command

The windows shell executes a default open command if you double 
click an Icon. It uses the first verb entered into the registry 
of a file type as the default open command. If for a specific 
file type you don't like this historical ordering you can 
specify your own ordering by enumerating the verbs you want to 
give priority in the default value of the registry key 
HKEY_CLASSES_ROOT\FileType name\Shell separated by semicolons 
(;). When looking for the open command to execute for a file 
with an unregistered extension the Windows shell will take a 
look at the shell commands registered with the file type *. If 
no shell commands are registered there, Windows will pass the 
file name to the shell commands registered with the file type 
'Unknown'. All the mentioned file types and registry keys used 
for the default open command are made easily accessible by 
Associate.

More?

Other handy features include easy setting of icon and 
description for a file type, editing the new menu presented by 
Explorer, and the options found in the previously mentioned 
file type dialogs of Explorer.
And yet that's not all. For profound abusers of bits Associate 
contains two tree views with a view on the parts of interest of 
the Windows registry. One view shows the file extension and one 
view shows the associated file type.

Associate example

This example will associate Associate.exe with all your files. 
Don't worry you can undo it.

Start Associate and maximize it's window. Find the speed button 
for starting RegEdit and click on it. Backup your registry by 
exporting the registry with the Menu register - Export. Really 
can't do that to often. Close RegEdit.

After you had a look around, empty the combo box labeled 
'Extension', and replace the text in the combo box labeled 
'File type of extension' with an asterisk (*). Associate will 
look up the file type * which you can use to specify properties 
that apply to 'all' your files. You might wonder how you ever 
managed without it.

Find the combo box labeled 'Shell verbs for file type' and type 
'Associate' into the combo as shell verb. Click on the browse 
button '>' at the right of the edit control labeled 'Command'. 
Select Associate.exe from the file dialog and confirm your 
choice. Associate might ask you whether you want to set the 
Icon for * to the Icon found in Associate.exe. Answer No and 
the job is done.

By now Explorer knows about Associate and you can start 
Associate from the alternate menu for all files having 
extensions matching *, that is for (almost) any file. Try it 
out by right clicking on a file and see how Asssociate appears 
as a menu item. Explorer will also launch Associate if you 
double click icons not having a better matching verb than 
Associate. On most systems this implies that if you double 
click any file not yet registered it will bring up Associate 
with the extension of the selected file focused.

Windows gives higher priority to the commands associated with 
'*' than the ones associated with 'Unknown'. 'Unknown' is the 
file type windows uses for extensions it does not yet know 
about. Normally Explorer brings up the Open as dialog for 
unregistered objects, by executing the 'openas' verb of the 
file type 'Unknown'.

To remove the Association between * and Associate.exe start 
Associate and empty the combo box labeled 'extension'. Specify 
* as the file type in the combo box labeled 'File type...'. 
From the combo box labeled 'Shell verbs ...' you can select 
Associate and click the delete speed button.

Comments and bugs

You can report comments and bugs to wmail@worldonline.nl.
Please specify the version number of Associate you are using.

That's All Folks.

Wilbert Hengst
